home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
pcv06n03.zip
/
AUTOASK.DOC
< prev
next >
Wrap
Text File
|
1993-06-05
|
2KB
|
48 lines
AUTOASK.COM March 1993 Dale Lewallen
Jeff Prosise
---------------------------------------------------------------
Purpose: Your lengthy AUTOEXEC.BAT file loads and runs a hard
disk optimizer. You recently installed a 500MB hard
disk that is partitioned into eight drives. With this
new setup, you don't always want to run the
optimizing program when you boot your machine. You'd
like AUTOEXEC.BAT to ask if you want to load a
particular program; if you don't answer within a
certain length of time, you'd like to specify a
default choice so the batch file can continue
executing.
Remarks: AUTOASK returns the ASCII code of the first key
pressed, letting you test it with an IF ERRORLEVEL
command. If no key is pressed within 10 seconds,
AUTOASK times out and returns either the ASCII code
for the letter N or, if you specified a different
character on the command line, the ASCII code for
that character.
For example, the following batch file asks if you
want to run CHKDSK. Pressing Y or y executes CHKDSK;
pressing any other key (or allowing the time-out
counter to expire) ends the batch file without
executing CHKDSK:
@ECHO OFF
ECHO Do you want to run CHKDSK?
AUTOASK
IF ERRORLEVEL 89 IF NOT ERRORLEVEL 90 GOTO DOIT
IF ERRORLEVEL 121 IF NOT ERRORLEVEL 122 GOTO
... DOIT
GOTO END
:DOIT
CHKDSK
:END
AUTOASK can also be set to execute the program when
the countdown timer runs out. In the above example,
you might want CHKDSK to execute when the countdown
timer expires. Just set the default response to Y by
changing the third line of the batch file to
AUTOASK Y